package com.healthcloud.service.impl;

import cn.jpush.api.bean.TestDateEntity;
import com.healthcloud.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.healthcloud.dao.SavingSampleInfo2Dao;
import com.healthcloud.entity.SavingSampleInfo2Entity;
import com.healthcloud.service.SavingSampleInfo2Service;
import com.healthcloud.utils.PageParam;
import org.springframework.transaction.annotation.Transactional;



@Service("savingSampleInfo2Service")
@Transactional
public class SavingSampleInfo2ServiceImpl implements SavingSampleInfo2Service {
	@Autowired
	private SavingSampleInfo2Dao savingSampleInfo2Dao;
	
	@Override
	public SavingSampleInfo2Entity queryObject(Integer id){
		return savingSampleInfo2Dao.queryObject(id);
	}
	
	@Override
	public List<SavingSampleInfo2Entity> queryList(SavingSampleInfo2Entity bean, PageParam pageParam){
		return savingSampleInfo2Dao.queryList(bean, pageParam);
	}
	
	@Override
	public int queryTotal(SavingSampleInfo2Entity bean){
		return savingSampleInfo2Dao.queryTotal(bean);
	}
	
	@Override
	public void save(SavingSampleInfo2Entity savingSampleInfo2){
		savingSampleInfo2Dao.save(savingSampleInfo2);
	}
	
	@Override
	public void update(SavingSampleInfo2Entity savingSampleInfo2){
		savingSampleInfo2Dao.update(savingSampleInfo2);
	}
	
	@Override
	public void delete(Integer id){
		savingSampleInfo2Dao.delete(id);
	}
	
	@Override
	public void deleteBatch(Integer[] ids){
		savingSampleInfo2Dao.deleteBatch(ids);
	}


	@Override
	public void saveJpushInfo(TestDateEntity testDateEntity) {

		SavingSampleInfo2Entity entity = new SavingSampleInfo2Entity();
		entity.setSnCode(testDateEntity.getMKMedicalinstrumentId());
		entity.setTestName(testDateEntity.getTestItemNameen());
		entity.setTestTime(DateUtils.strToDate(testDateEntity.getTestTime(),"yyyy-MM-dd HH:mm:ss"));
		entity.setCreatedTime(new Date());
		savingSampleInfo2Dao.save(entity);
	}
}
